import requests
from pyquery import PyQuery as pq

url = "https://bj.fang.com/quanwangso/search.html?city=bj&refer=sy_seach"
response = requests.get(url)
html = response.text

doc = pq(html)
categories = doc('.lp-condition-list > a')
for category in categories:
    category_name = pq(category).text()
    category_url = pq(category).attr('href')
    print("分类名称:", category_name)
    print("分类网址:", category_url)
